package day015.set;

import java.util.Iterator;
import java.util.TreeSet;

public class TestSetDemo {
    public static void main(String[] args) {
        TreeSet<Integer> ts = new TreeSet<>();
        ts.add(10);
        ts.add(10);
        ts.add(20);
        ts.add(10);
        ts.add(30);

        Iterator<Integer> it = ts.iterator();
        while (it.hasNext()) {
            Integer s = it.next();
            System.out.println(s);
        }

        System.out.println("=============================");

        for (Integer t : ts) {
            System.out.println(t);
        }


    }
}
